<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@ include file="/common/meta.jsp"%>
<link href="<s:url value='/css/main.css'/>" rel="stylesheet"
	type="text/css" />
<link rel="stylesheet"
	href="<s:url value='/js/jquery/plugins/jquery-treeview/jquery.treeview.css'/>" type="text/css" />
<script type="text/javascript" language="JavaScript"
	src="<s:url value='/js/jquery/jquery-1.3.2.min.js'/>"></script>
<script type="text/javascript" language="JavaScript"
	src="<s:url value='/js/jquery/plugins/jquery-treeview/jquery.treeview.js'/>"></script>
<script type="text/javascript"
	src="<s:url value='/js/DatePicker/DatePicker.js'/>"></script>
<script type="text/javascript">
	function setCategory(obj, treeId){
		$("input[name='item.categoryId']")[0].value = obj.getAttribute("tvalue");
		var xxs = $("#"+treeId).find("a");
		for(i=0; i<xxs.length; i++){
			xxs[i].style.backgroundColor = "";
		}
		obj.style.backgroundColor = "lightblue";
	}

	$(function(){
		$("#categoryTree").treeview({
			persist: "location",
			collapsed: false,
			unique: true
		});

		var parentId = $("input[name='item.categoryId']")[0].value;
		var xxs = $("#categoryTree").find("a");
		for(i=0; i<xxs.length; i++){
			if(xxs[i].getAttribute("tvalue") == parentId) {
				xxs[i].style.backgroundColor = "lightblue";
			}
		}
	});
</script>
<title>资源编辑</title>
</head>
<body>
<s:if test="%{message != null}">
	<font color="red"><s:property value="message" escape="false" /></font>
</s:if>
<br />
<s:if test='%{item.id == null || item.id.equals("")}'>
	<font color="red">参数错误</font>
</s:if>
<s:else>
<s:form action="ResourceSave" namespace="/" method="post">
	<s:hidden name="item.id"></s:hidden>
	<table width="100%" border="0" cellpadding="3" cellspacing="1"
		bgcolor="#E2E2E2">
		<tr class="tr1">
			<td colspan="4">资源编辑</td>
		</tr>
		<tr class="tab">
			<td class="td1">文件名：<font color="red">*</font></td>
			<td><s:textfield name="item.fileName" size="20"></s:textfield>&nbsp;&nbsp;&nbsp;<a target="_blank" href="<s:url value='/ResourceDownload.do?p=%{item.id}' />">下载</a></td>
			<td class="td1">Content-Type：</td>
			<td><s:property value="item.contentType" /></td>
		</tr>
		<tr class="tab">
			<td class="td1">文件真实路径：</td>
			<td colspan="3"><s:property value="item.absolutePath" /></td>
		</tr>
		<tr class="tab">
			<td class="td1">资源描述：</td>
			<td colspan="3"><s:textarea name="item.description" cols="50" rows="5"></s:textarea></td>
		</tr>
		<tr class="tab">
			<td class="td1">资源分类：</td>
			<td colspan="3">
			<s:hidden name="item.categoryId"></s:hidden>
			<s:hidden name="treeString"></s:hidden>
			<s:property value="treeString" escape="false" />
			</td>
		</tr>
		<tr class="tab">
			<td class="td1">上传者：</td>
			<td><s:property value="item.uploadUserName" /></td>
			<td class="td1">上传IP：</td>
			<td><s:property value="item.uploadIp" /></td>
		</tr>
		<tr class="tab">
			<td class="td1">上传时间：</td>
			<td><s:property value="item.uploadTime" /></td>
			<td class="td1">下载次数：</td>
			<td><s:property value="item.downloadTimes" /></td>
		</tr>
		<tr class="tab">
			<td class="td1">审核者：</td>
			<td><s:property value="item.auditUserName" /></td>
			<td class="td1">审核者IP：</td>
			<td><s:property value="item.auditIp" /></td>
		</tr>
		<tr class="tab">
			<td class="td1">审核结果：</td>
			<td><s:select name="item.auditResult" list="#{'0':'待审核','1':'审核中','2':'审核通过','3':'审核不通过'}"></s:select></td>
			<td class="td1">审核时间：</td>
			<td><s:property value="item.auditTime" /></td>
		</tr>
		<tr class="tab">
			<td class="td1">审核备注：</td>
			<td colspan="3"><s:textarea name="item.auditRemark" cols="50" rows="5"></s:textarea></td>
		</tr>
		<tr class="tab">
			<td class="td1">下载地址：</td>
			<td colspan="3">
				网页下载:<a target="_blank" href="<s:property value="item.HttpDownAddress" />"><s:property value="item.HttpDownAddress" /></a>
				<br/>FTP下载:<a target="_blank" href="<s:property value="item.FtpDownAddress" />"><s:property value="item.FtpDownAddress" /></a>
			</td>
		</tr>
		<tr class="tab">
			<td colspan="4"><s:submit cssClass="button" value="保存"></s:submit></td>
		</tr>
	</table>
</s:form>
<br />
</s:else>
</body>
</html>